import java.util.Scanner;

public class FifthQuestion {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入一个整数（输入0结束）");
        int num = input.nextInt();
        int max = num;
        int min = num;
        while (true){
            System.out.println("请输入一个整数（输入0结束）");
             num = input.nextInt();
            if (num>max){
                max=num;
            }
            if (num<min){
                min=num;
            }
            if (num==0){
                break;
            }

        }
        System.out.println("最大值为："+max);
        System.out.println("最小值为："+min);
    }
}
